let server = require("express")();
let mysql = require("mysql");
let sql = mysql.createConnection({
    host: 'localhost',
    user: 'root',
    password: '724372',
    database: 'teach',

}); 
sql.connect();
server.get("/test", function(request, response) {
    let callback = request.query.callback;
    sql.query(`SELECT * FROM flights`, function(error, data) {
            if (error) {
                console.log(error);
                response.end("error");
                return;
            }
            response.end(`${callback}(${JSON.stringify(data)})`)
        })
        // 给前端传的实参

});
server.listen(8080);